import Sequelize from 'sequelize'
import sequelize from '../../../database/index'

module.exports = sequelize.define('customer_unit',{
    id:{
        type: Sequelize.UUIDV4,
        defaultValue: Sequelize.UUIDV4,
        unique: true,
        allowNull: false,
        primaryKey:true
    },
    customer_group_id: {
        type: Sequelize.STRING,
        allowNull: false,
        references:{
            model: 'customer_group',
            key: 'id'
        }
    },
    customer_unit_name:{
        type: Sequelize.STRING,
        allowNull: false
    },
    contact_name: {
        type: Sequelize.STRING,
        allowNull: false
    },
    contact_tel: {
        type: Sequelize.STRING,
        allowNull: false
    },
    supervise_tel:{
        type: Sequelize.STRING,
        allowNull: false
    },
    shortv_tel:{
        type: Sequelize.STRING,
        allowNull: false
    },
    pinyin_name:{
        type: Sequelize.STRING
    },
    memo: {
        type: Sequelize.STRING
    },
    status:{
        type:Sequelize.INTEGER,
        defaultValue: 0,
        allowNull: false
    },
    created_man: {
        type: Sequelize.STRING,
        allowNull: false
    }
},{
    freezeTableName:false,
    tableName: 'customer_unit',
    updatedAt:'updated_at',
    createdAt:'created_at'
});